<?php
return array(
    '_id' => 'register',
    '_form' => array(
        'action' => '',
        'method' => 'post',
        'class' => [],
        'accept-charset' => 'utf-8',
        'role' => 'form',
        'id' => 'register',
    ),
    'name' => array(
        'label' => '用户名',
        'error' => '',
        'description' => '用户昵称',
        'widget' => 'Text',
        'validate' => [],
        'attributes' => array(
            'class' => 'form-control',
        ),
        'filter' => ['safeFilter'],
        'required' => true,
    ),
    'email' => array(
        'label' => '邮箱',
        'error' => '',
        'description' => '您正在使用的邮箱',
        'widget' => 'Email',
        'validate' => [],
        'attributes' => array(
            'class' => 'form-control',
        ),
        'required' => true,
    ),
    'password' => array(
        'label' => '密码',
        'error' => '',
        'description' => '登陆密码',
        'widget' => 'Password',
        'filter' => ['safeFilter'],
        'attributes' => array(
            'class' => 'form-control',
        ),
        'validate' => [
            [
                'v' => 'Regex',
                'pattern' => '^[a-z0-9A-Z_#]{1,}$',
                'message' => '验证码由字母数字 _ # 组成',
            ],
            [
                'v' => 'StringLength',
                'max' => 12,
                'min' => 8,
            ],
            [
                'v' => 'Confirmation',
                'with' => 'confirmPassword',
                'message' => '前后输入的密码不一样',
            ],
        ],
        'required' => true,
    ),
    'confirmPassword' => array(
        'label' => '确认密码',
        'error' => '',
        'description' => '重复之前输入的密码',
        'widget' => 'Password',
        'filter' => ['safeFilter'],
        'attributes' => array(
            'class' => 'form-control',
        ),
        'validate' => [
            [
                'v' => 'Regex',
                'pattern' => '^[a-z0-9A-Z_#]{1,}$',
                'message' => '验证码由字母数字 _ # 组成',
            ],
            [
                'v' => 'StringLength',
                'max' => 12,
                'min' => 8,
            ],
            [
                'v' => 'Confirmation',
                'with' => 'password',
                'message' => '前后输入的密码不一样',
            ],
        ],
        'required' => true,
    ),
    'verCode' => array(
        'label' => '验证码',
        'userOptions' => [],
        'error' => '',
        'description' => '请你输入你看到的验证码',
        'field' => 'validateCode',
        'widget' => 'ValidateCode',
        'validate' => array(
            [
                'v' => 'Regex',
                'pattern' => '^[a-z0-9A-Z]{4}$',
                'message' => '验证码由长度为4的字母数组组成',
            ],
            [
                'v' => 'Function',
                'function' => '\Core\Library\ValidateCode::validate',
                'message' => '验证码输入错误',
            ],
        ),
        'attributes' => array(
            'class' => 'form-control',
        ),
        'required' => true,
    ),
    'xieyi' => array(
        'label' => '已经阅读并同意《服务协议》',
        'userOptions' => [],
        'error' => '',
        'description' => '已经阅读并同意《服务协议》',
        'field' => 'boole',
        'widget' => 'Checkbox',
        'validate' => [
            array(
                'v' => 'Identical',
                'message' => '必须同意协议',
            ),
        ],
        'value' => 'on',
        'attributes' => [],
        'filter' => ['safeFilter'],
        'required' => true,
    ),
    '_options' => array(
        'success' => '登陆，更换账户请退出后登陆',
        'save' => '\Modules\User\Library\Common::registerEmail',
    ),
);
